{% extends "base_admin.html" %}
{% load static %}

{%block css%}
<link rel="stylesheet" href="{%static '/css/counselor_index.css'%}">
{%endblock%}

{% block active4 %}
active
{%endblock%}


{%block content%}

<div class="panel panel-default">
  <div class="panel-heading">
    <h3 class="panel-title">老师搜索</h3>
  </div>
  <div class="panel-body " >
            <a class="btn btn-default" href="" style="float: left;">
                <span class="glyphicon glyphicon-list" aria-hidden="true"></span>
                添加教师
            </a>
            <form action="" method="get" style="float: right;" class="col-sm-3">
                <div class="input-group">
                    <input type="text" name="name" class="form-control" placeholder="请输入姓名" autocomplete="off">
                    <span class="input-group-btn">
                        <button class="btn btn-default" type="submit"><span class="glyphicon glyphicon-search" aria-hidden="true"></span></button>
                    </span>
                </div>
            </form>
  </div>
</div>


<table class="table table-striped">
    <thead>
        <tr>
            <td>序号</td>
            <td class="">姓名</td>
            <td class="">性别</td>
            <td class="">所在学院</td>
            <td class="">出生年月</td>
            <td class="">民族</td>
            <td class="">政治面貌</td>
            <td class="">毕业院校</td>
            <td class="">所学专业</td>
            <td class="">学历</td>
            <td class="">入职时间</td>
            <td class="">电话</td>
            <td>操作</td>
        </tr>
    </thead>
    <tbody>
            {% for counselor_info in counselor_infos %}
                <tr>
                    <td class="info_id">{{forloop.counter0|add:page_id_start}}</td>
                    <td>{{counselor_info.name}}</td>
                    <!-- 通过get_字段名_display方法找到对应choices -->
                    <td>{{counselor_info.get_gender_display}}</td>
                    <!-- 获得college对象，通过get_字段名_display方法找到对应choices -->
                    <td>{{counselor_info.college.get_college_display}}</td>
                    <td>{{counselor_info.birthdate}}</td>
                    <td>{{counselor_info.nationality}}</td>
                    <td>{{counselor_info.political_affiliation}}</td>
                    <td>{{counselor_info.graduate_school}}</td>
                    <td>{{counselor_info.major}}</td>
                    <td>{{counselor_info.degree}}</td>
                    <td>{{counselor_info.enter_time}}</td>
                    <td>{{counselor_info.phone_number}}</td>
                    <td>
                        <a class="btn btn-primary btn-xs">编辑</a>
                        <a class="btn btn-danger btn-xs">删除</a>
                    </td>
                </tr>
            {% endfor %}
    </tbody>
</table>

<nav aria-label="Page navigation">
  <ul class="pagination" style="width: 100%;">
    {{page_str}}
  {{page_info}}
  </ul>
</nav>

{%endblock%}

{%block script%}
<script>
    // let start=({{page}}-1)*{{page_size}}+1
    // $('.info_id').each(function(index){
    //     $(this).text(index+start)
    // })
</script>
{%endblock%}